<?php if($subjectID=="") {?>
<div>
  <h4><a class="no-underline" href="<?php echo Yii::app()->baseUrl ?>/document/index/subjectID/<?php echo md5($data['subjectID']) ?>"><?php echo $data["subject"]?></a></h4>
  <div>
  <?php
    foreach ($data as $row) {
      if(is_array($row)) {
  ?>
        <div class="row-doc">
        <i class="icon-hand-right"></i> 
        	<a href="<?php echo Yii::app()->baseUrl?>/document/detail/ID/<?php echo md5($row['ID'])?>"><?php echo $row['name']?></a>
        </div>
  <?php 
      }
    } 
  ?>
  </div>
</div>
<?php } else {?>
<div class="clearfix">
  <h4><a class="no-underline" href="<?php echo Yii::app()->baseUrl ?>/document/index/topicID/<?php echo md5($data['topicID']) ?>"><?php echo $data["topic"]?></a></h4>
  <div class="topic-group">
  <?php
    $i = 1;
    foreach ($data as $row) {
      if(is_array($row)) {
        if($i>3)
          break;
  ?>
        <div class="row-doc clearfix">
        	<?php
            $file = Document::model()->getPhoto($row['ID']);
            $photo = Yii::app()->baseUrl."/upload/document/thumbs_100x100/".$file;
            if($file=="") {
              $photo = Yii::app()->baseUrl."/images/no-image.jpg";
            } 
        	?>
        	<img class="img-doc pull-left img-rounded img-polaroid" alt="photo" src="<?php echo $photo?>">
        	<div class="pull-right" style="width: 75%">
          	<a class="clearfix" href="<?php echo Yii::app()->baseUrl?>/document/detail/ID/<?php echo $row['ID']?>"><?php echo $row['name']?></a>
          	<?php echo $row['description']?>
        	</div>
        </div>
  <?php 
      $i++;
      }
    }
  ?>
  </div>
  <?php 
    if(count($data)>3) { 
  ?>
  	<a class="badge pull-right" href="<?php echo Yii::app()->baseUrl?>/document/index/topicID/<?php echo md5($data['topicID'])?>">» Xem tất cả</a>
  <?php }?>
</div>
<?php }?>